package cn.chengpengper.shortlink.controller;

import cn.chengpengper.shortlink.constant.RedisKeyTemplate;
import cn.chengpengper.shortlink.controller.request.SendCodeRequest;
import cn.chengpengper.shortlink.service.NotifyService;
import cn.chengpengper.shortlink.util.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author huchengpeng
 * @version v1.0.0
 * @date 2023/8/20 18:42
 * @description 通知Controller
 */
@RestController
@RequestMapping("/api/notify/")
public class NotifyController {

    @Autowired
    private NotifyService notifyService;

    @PostMapping("v1/sendCode")
    public JsonData sendCode(@RequestBody SendCodeRequest sendCodeRequest, HttpServletRequest request) {
        return notifyService.sendCode(RedisKeyTemplate.ACCOUNT_CAPTCHA_KEY, request, sendCodeRequest);
    }

}
